<!doctype html>
<html lang="en">
<head>
    <title>Grid - Datasources</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <meta name="author" content="ComponentOne" />
    <link href="../base-reset.css" rel="stylesheet" type="text/css" />
    <link href="../../themes/Aristo/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css" />
    <link href="../demos-single.css" rel="stylesheet" type="text/css" />
    <link href="../../themes/wijmo/jquery.wijmo-open.0.8.2.css" rel="stylesheet" type="text/css" />
    <link href="../../themes/wijmo/jquery.ui.wijgrid.css" rel="stylesheet" type="text/css" />

    <script src="../../external/jquery-1.4.3.min.js" type="text/javascript"></script>
    <script src="../../external/jquery-ui-1.8.6.custom.min.js" type="text/javascript"></script>
    <script src="../../external/jquery.glob.min.js" type="text/javascript"></script>
    <script src="../../external/jquery.mousewheel.min.js" type="text/javascript"></script>

    <script src="../../external/jquery.wijmo-open.0.8.2.min.js" type="text/javascript"></script>
    <script src="../../wijmo/jquery.ui.wijdatasource.js" type="text/javascript"></script>
    <script src="../../wijmo/jquery.ui.wijgrid.js" type="text/javascript"></script>

    <script id="scriptInit" type="text/javascript">
        $(document).ready(function () {
            // dom
            $("#demo-dom").wijgrid();

            // array
            $("#demo-array").wijgrid({
                data: [
                ["ANATR", "Ana Trujillo Emparedados y helados", "Ana Trujillo"],
                ["ANTON", "Antonio Moreno Taqueria", "Antonio Moreno"],
                ["AROUT", "Around the Horn", "Thomas Hardy"],
                ["BERGS", "Berglunds snabbkop", "Christina Berglund"]
              ],
                columns: [
                 { headerText: "ID" }, { headerText: "Company" }, { headerText: "Name" }
              ]
            });

            // hash
            $("#demo-hash").wijgrid({
                data: [
                { ID: "ANATR", Company: "Ana Trujillo Emparedados y helados", Name: "Ana Trujillo" },
                { ID: "ANTON", Company: "Antonio Moreno Taqueria", Name: "Antonio Moreno" },
                { ID: "AROUT", Company: "Around the Horn", Name: "Thomas Hardy" },
                { ID: "BERGS", Company: "Berglunds snabbkop", Name: "Christina Berglund" }
              ]
            });

            // remote
            $("#demo-remote").wijgrid({
                data: new wijdatasource({
                    proxy: new wijhttpproxy({
                        url: "http://ws.geonames.org/searchJSON",
                        dataType: "jsonp",
                        
                        key: "geonames"
                    }),
                    reader: new wijarrayreader([
                     { name: "label", mapping: function (item) { return item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName } },
                     { name: "name", mapping: "name" },
                     { name: "countryCode", mapping: "countryCode" },
                     { name: "continentCode", mapping: "continentCode" }
                  ])
                })
            });
        });
    </script>
</head>
<body class="demo-single">
    <div class="container">
        <div class="header">
            <h2>
                Datasources</h2>
        </div>
        <div class="main demo">
            <!-- Begin demo markup -->
            <p>DOM table:</p>
            <table id="demo-dom">
                <thead>
                    <tr>
                        <th>
                            ID
                        </th>
                        <th>
                            Company
                        </th>
                        <th>
                            Name
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            ANATR
                        </td>
                        <td>
                            Ana Trujillo Emparedados y helados
                        </td>
                        <td>
                            Ana Trujillo
                        </td>
                    </tr>
                    <tr>
                        <td>
                            ANTON
                        </td>
                        <td>
                            Antonio Moreno Taqueria
                        </td>
                        <td>
                            Antonio Moreno
                        </td>
                    </tr>
                    <tr>
                        <td>
                            AROUT
                        </td>
                        <td>
                            Around the Horn
                        </td>
                        <td>
                            Thomas Hardy
                        </td>
                    </tr>
                    <tr>
                        <td>
                            BERGS
                        </td>
                        <td>
                            Berglunds snabbkop
                        </td>
                        <td>
                            Christina Berglund
                        </td>
                    </tr>
                </tbody>
            </table>

            <p>Array:</p>
            <table id="demo-array">
            </table>

            <p>Hash:</p>
            <table id="demo-hash">
            </table>

            <p>Remote:</p>
            <table id="demo-remote">
            </table>
            <!-- End demo markup -->
            <div class="demo-options">
                <!-- Begin options markup -->
                <!-- End options markup -->
            </div>
            <div class="footer demo-description">
                <p>
                </p>
            </div>
        </div>
    </div>
</body>
</html>
